package com.ngovanhau.justsort.model;

import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.anddev.andengine.opengl.texture.region.TextureRegion;

import android.content.Context;
import android.util.Log;

import com.ngovanhau.justsort.MainGameActivity;
import com.ngovanhau.justsort.MySprite;
import com.ngovanhau.justsort.item.config.MyConfig;

public class BackgroundNumber extends MySprite{
	
	private BitmapTextureAtlas bg_number_BTA;
	private Sprite bg_number_SP;
	private TextureRegion bg_number_TR;
	
	int Y_axis = 0;
	
	public void onLoadResource(Engine enginex, Context contextx){
		this.engine = enginex;
		this.context = contextx;
		this.mainGame = (MainGameActivity) contextx;
		
		BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("images/");
		
		this.bg_number_BTA = new BitmapTextureAtlas(1024, 1024);
		this.bg_number_TR = BitmapTextureAtlasTextureRegionFactory.createFromAsset(bg_number_BTA, contextx, "game_bg_number.png", 0, 0);
		enginex.getTextureManager().loadTexture(bg_number_BTA);
	}
	
	public void onLoadScene(Scene scene){
		this.scene = scene;
		
		this.bg_number_SP = new Sprite(0, MyConfig.Y_START - MyConfig.X_START_ * MyConfig.RACE_HEIGHT, MyConfig.WIDTH_BG, MyConfig.HEIGHT_BG + 2 * MyConfig.X_START_ * MyConfig.RACE_HEIGHT, this.bg_number_TR);
		scene.attachChild(bg_number_SP);
		Log.d("thuy yoyo", "size: " + MyConfig.WIDTH_BG);
	}
}
